<?php

namespace frontend\modules\yii2\widgets\layouts\example;

use frontend\modules\yii2\widgets\layouts\example\assets\ExampleAsset;
use yii\base\Widget;

/**
 * A menu imitate the sidebar of https://docs.docker.com/get-started/
 *
 * @note It's depend on bootstrap;
 *
 * @example :
 * ```php

 * ```
 * @author chenzhiwei <chenzhiweiwk@qq.com>
 * @date   2021/08/31
 */
class Example extends Widget
{
    public $html = "";
    public $yii = "";
    public $bootstrap = "";

    public function init()
    {
        parent::init(); // TODO: Change the autogenerated stub
        ExampleAsset::register($this->getView());
        $this->yii = \yii\helpers\Markdown::process("```php\n" . $this->yii . "\n```", "gfm");
        $this->bootstrap = \yii\helpers\Markdown::process("```html\n" . $this->bootstrap . "\n```", "gfm");
    }

    public function run()
    {
        $content = <<<CONTENT
<div class="cms-article-example">
    <div class="cms-example">Example</div>
    <div class="cms-html">{$this->html}</div>
    <div class="cms-code row">
        <div class="cms-code-widget col-md-6">
              <div class="cms-code-title">Yii</div>
              <div class="cms-code-body">{$this->yii}</div>
        </div>
        <div class="cms-code-bootstrap col-md-6">
              <div class="cms-code-title">Bootstrap</div>
              <div class="cms-code-body">{$this->bootstrap}</div>
        </div>
    </div>
</div>
CONTENT;

        return $content;
    }

}
